package com.cnsoft.portal.login;

import org.cnsoft.framework.beans.user.UserBean;
import org.cnsoft.framework.cache.session.SessionHelper;
import org.cnsoft.framework.support.MyPageControllerSupport;
import org.cnsoft.framework.utils.DateHelper;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

/**
 * 超管登录
 * 
 * @author ZmSoft
 * @version 0.1.0 2018/3/1
 * @since 0.1.0 2018/3/1
 */
@Controller
// @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
@RequestMapping(value = "/pc/1.0/manager")
public class PageManagerLogin2Controller extends MyPageControllerSupport {

	/**
	 * 用户登录页面
	 * 
	 * @param request
	 * @param response
	 * @param loginer
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value = "/login.do", method = { RequestMethod.GET, RequestMethod.POST })
	public ModelAndView doManagerLoginPOST() throws Exception {
		ModelAndView modelAndView = new ModelAndView("/manager/login2");
		modelAndView.addObject("DDD", DateHelper.currentTimeMillisCN1());
		UserBean currentUser = SessionHelper.currentUser();
		modelAndView.addObject("loginer", currentUser);
		// 是否管理员(1不是2是)
		logger.debug("currentUser=="+currentUser.toJsonString());
		if (TWO.equals(currentUser.getIsAdmin()) == false) {
			modelAndView.addObject("message", "您不是超级管理员，不能进入");
		}

		return modelAndView;
	}

}
